<?php
defined('IN_YuLin') || exit('NO PERMIT!');
UserLogin(U($m.'/'.$c.'/'.$a));


$tag_uid  = NoBadStr($_GET['tag_uid']);
$username = NoBadStr($_GET['username']);
$where    = ' WHERE 1';
if ($tag_uid){
    $where .= ' AND u.id = ' . $tag_uid;
}

if ($username){
    $where .= ' AND u.username = "' . $username . '"';
}
// 防止代理乱输入账号查询别人的会员信息
$sql     = 'SELECT id FROM ' . Table('user_invita_code') . ' WHERE uid = ' . $_uid;
$agentCodeData = $db->getall($sql, 'id');
$codeIdStr = implode(',', array_keys($agentCodeData));
$where  .= ' AND info.invita_code_id IN (' . $codeIdStr . ')';

$sql     = '
            SELECT u.`id`, u.`username` FROM ' . Table('user') . ' AS u
            LEFT JOIN ' . Table('user_info') . ' AS info
            ON u.`id` = info.`uid`' . $where;


$tagInfo = $db->getrow($sql);
$limit   = 10;
$tpl->display('member/agentBillRecord');
